package com.xuanxu.module.system.controller.admin;

import com.xuanxu.framework.common.pojo.ResponseBean;
import com.xuanxu.module.system.pojo.dao.UserDO;
import com.xuanxu.module.system.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author XuanXu
 * @version 1.0
 * @date 2024-06-14 21:33
 */
@RestController
@RequestMapping("/admin-api/user")
@Api(tags = "用户相关接口")
@RequiredArgsConstructor
public class AdminUserController {

    private final UserService userService;

    @GetMapping("/test")
    @ApiOperation("测试接口1")
    public String test() {
        return "test...";
    }

    @GetMapping("/test1")
    @ApiOperation("测试接口2")
    public ResponseBean<String> test1() {
        return ResponseBean.success("test1...");
    }

    @GetMapping("/test2")
    @ApiOperation("测试响应状态码错误接口")
    public ResponseBean<String> test2() {
        return ResponseBean.fail(200, "失败", "test2...");
    }


    @GetMapping("/test/mybaitsplus")
    @ApiOperation("测试是否能够连接数据库")
    public ResponseBean<List<UserDO>> testmybatis() {
        return ResponseBean.success(userService.testMybatis());
    }
}
